class CreateSchools < ActiveRecord::Migration
  def self.up
    create_table :schools do |t|
      # app require
      t.column :area_id,            :integer
      t.column :submitor_id,        :integer
      t.column :info_source,        :string
      t.column :is_validate,        :boolean, :default => false
      t.column :is_hidden,          :boolean, :default => false
      t.column :created_at,         :datetime
      t.column :updated_at,         :datetime
      
      # School Info
      # ==================================
      # school base info
      t.column :title,              :string
      t.column :address,            :string
      t.column :zipcode,            :integer
      t.column :master,             :string
      t.column :telephone,          :string
      
      t.column :contact_name,       :string
      t.column :contact_role,       :string
      t.column :contact_telephone,  :string
      t.column :contact_email,      :string
      
      t.column :level_amount,       :string
      t.column :teacher_amount,     :string
      t.column :class_amount,       :string
      t.column :student_amount,     :string

      t.column :has_library,        :integer, :limit => 1
      t.column :has_pc,             :integer, :limit => 1
      t.column :has_internet,       :integer, :limit => 1
      t.column :book_amount,        :integer
      t.column :pc_amount,          :integer
      
      t.column :incoming_from,      :string
      t.column :incoming_average,   :integer, :limit => 1
      
      t.column :has_ngo,            :integer, :limit => 1
      t.column :ngo_name,           :string
      t.column :ngo_start_at,       :date
      t.column :ngo_contact_name,   :string
      t.column :ngo_contact_via,    :string
      
      # traffic guide
      t.column :traffic_sights,     :string
      t.column :traffic_type,       :string
      t.column :traffic_duration,   :string
      t.column :traffic_description,:text
      t.column :traffic_charge,     :string
      
      # school requirements
      t.column :books_need,         :string
      t.column :stationaries_need,  :string
      t.column :sports_need,        :string
      t.column :clothes_need,       :string
      t.column :accessories_need,   :string
      t.column :others_need,        :string
      t.column :classes_need,       :string
      t.column :teachers_need,      :string
      
      # school finder info
      t.column :finder_name,        :string
      t.column :finder_qq,          :string
      t.column :finder_msn,         :string
      t.column :finder_email,       :string
      t.column :finder_survey_at,   :date
      
      t.column :advice,             :text
    end
  end

  def self.down
    drop_table :schools
  end
end
